﻿Public Class frmXemChiTietDK 
    Public _dkDTO As New DangKyDTO
    Public _svDTO As New SinhVienDTO
    Public tableLoaiNha As New DataTable
    Public tableKhuVuc As New DataTable
    Private Sub frmXemChiTietDK_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        '----------------------------------------------------------------------------------------------------
        Dim loaiNhaDTO As New LoaiNhaDTO
        Dim loaiNhaBUS As New LoaiNhaBUS
        '----------------------------------------------------------------------------------------------------
        Dim kvDTO As New KhuVucDTO
        Dim kvBUS As New KhuVucBUS
        '----------------------------------------------------------------------------------------------------
        tableLoaiNha = loaiNhaBUS.GetAll()
        tableKhuVuc = kvBUS.GetAll()
        '------------------------------------------------------------------------------------------
        For i As Integer = 0 To tableLoaiNha.Rows.Count - 1
            If Convert.ToInt32(tableLoaiNha.Rows(i)("MaLoaiNha").ToString()) = _dkDTO.MaLoaiNha Then
                lbLoaiNha.Text = tableLoaiNha.Rows(i)("TenLoaiNha").ToString()
                Exit For
            End If
        Next
        For i As Integer = 0 To tableKhuVuc.Rows.Count - 1
            If Convert.ToInt32(tableKhuVuc.Rows(i)("MaKhuVuc").ToString()) = _dkDTO.MaKhuVucThue Then
                lbKhuVuc.Text = tableKhuVuc.Rows(i)("TenKhuVuc").ToString()
                Exit For
            End If
        Next
        '---------------------------------------------------------------------------------------------------
        lbDienTich.Text = _dkDTO.DienTich.ToString() + " (m2)"
        lbGiaThue.Text = _dkDTO.GiaThue.ToString() + " (VNĐ)"
        lbSucChua.Text = _dkDTO.SucChua.ToString() + " (người)"
        lbTieuDe.Text = _dkDTO.TieuDe.ToString()
        lbHoTen.Text = _svDTO.HoTen
        lbSDT.Text = _svDTO.DienThoai
        lbEmail.Text = _svDTO.Email
        '--------------------------------------------------------------------------------------------------
        If _dkDTO.ChoNamThue = 1 Then
            ckChoNamThue.Checked = True
        Else
            ckChoNamThue.Checked = False
        End If

        If _dkDTO.ChoNuThue = 1 Then
            ckChoNuThue.Checked = True
        Else
            ckChoNuThue.Checked = False
        End If

        If _dkDTO.ChoNauAn = 1 Then
            ckNauAn.Checked = True
        Else
            ckNauAn.Checked = False
        End If

        If _dkDTO.OChungChu = 1 Then
            ckChungChu.Checked = True
        Else
            ckChungChu.Checked = False
        End If

        If _dkDTO.OGhep = 1 Then
            ckOGhep.Checked = True
        Else
            ckOGhep.Checked = False
        End If

        If _dkDTO.Internet = 1 Then
            ckInternet.Checked = True
        Else
            ckInternet.Checked = False
        End If

        If _dkDTO.TruyenHinhCap = 1 Then
            ckTruyenHinhCap.Checked = True
        Else
            ckTruyenHinhCap.Checked = False
        End If

        If _dkDTO.GanTramXeBuyt = 1 Then
            ckXeBuyt.Checked = True
        Else
            ckXeBuyt.Checked = False
        End If
    End Sub

    Private Sub SimpleButton2_Click(sender As System.Object, e As System.EventArgs)
        Me.Close()
    End Sub

    Private Sub Panel1_Paint(sender As System.Object, e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint

    End Sub

    Private Sub SimpleButton2_Click_1(sender As System.Object, e As System.EventArgs) Handles SimpleButton2.Click
        Me.Close()
    End Sub
End Class